package com.xja.web.domain.commons;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.IOException;

public class MenuCreat {
    public static void main(String[] args) {
        String str="https://api.weixin.qq.com/cgi-bin/menu/create?access_token="+Constant.getAccessToken();
        JSONObject jsonObject = new JSONObject();
        JSONArray menuArray = new JSONArray();
        JSONObject oneJson = new JSONObject();
        oneJson.put("type","view");
        oneJson.put("name","别点！贵");
        oneJson.put("url",Constant.getUrl("http://adu867g.hn3.mofasuidao.cn/app/index.html"));
        JSONObject twoJson = new JSONObject();
        twoJson.put("type","view");
        twoJson.put("name","购物车");
        twoJson.put("url",Constant.getUrl("http://adu867g.hn3.mofasuidao.cn/app/shopcar.html"));
        JSONObject threeJson = new JSONObject();
        threeJson.put("type","view");
        threeJson.put("name","个人中心");
        threeJson.put("url",Constant.getUrl("http://adu867g.hn3.mofasuidao.cn/app/pcenter.html"));
        menuArray.put(oneJson);
        menuArray.put(twoJson);
        menuArray.put(threeJson);
        jsonObject.put("button",menuArray);
        try {
            JSONObject jsonObject1 = HttpClienUtil.doPost(str, jsonObject.toString());
            System.out.println(jsonObject1);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
